﻿using System;

namespace Mal.Balades.Admin.Services
{

    public delegate void ServiceResponse<ResultType>(ServiceResponseArgs<ResultType> e);

    public class ServiceResponseArgs<ResultType>
    {
        #region Fields
        private ResultType result;
        private Exception error;
        private object userState;
        #endregion

        #region Construction / Destruction
        public ServiceResponseArgs(ResultType result)
        {
            this.Result = result;
        }

        public ServiceResponseArgs(ResultType result, object userState)
            : this(result)
        {
            this.UserState = userState;
        }

        public ServiceResponseArgs(Exception exception)
        {
            this.Error = exception;
        }

        public ServiceResponseArgs(Exception exception, object userState)
            : this(exception)
        {
            this.UserState = userState;
        }
        #endregion

        #region enum, struct, class

        #endregion

        #region Properties
        public ResultType Result
        {
            get { return result; }
            private set { result = value; }
        }

        public Exception Error
        {
            get { return error; }
            private set { error = value; }
        }

        public object UserState
        {
            get { return userState; }
            private set { userState = value; }
        }
        #endregion

        #region Methods

        #endregion

        #region Events

        #endregion


    }
}
